<?php

namespace App\Http\Controllers\user;

use App\Dao\OrdersDao;
use App\Exceptions\SysExceptions;
use App\Services\Code;

class OrdersController extends BaseController
{
    /**
     * @throws SysExceptions
     */
    public function add_order(): array
    {
        $params = array_merge(request()->all(),[
            'user_id'=>getUserToken()
        ]);

        return Code::message('',200,OrdersDao::add_order($params));
    }




    public function orders(): array
    {
        $params = array_merge(request()->all(),[
            'user_id'=>getUserToken(),
        ]);
        return Code::message('',200,OrdersDao::datas($params));
    }
    public function orders_info(): array
    {
        $params = array_merge(request()->all(),[
            'user_id'=>getUserToken()
        ]);
        return Code::message('',200,OrdersDao::datas_info($params));
    }


    //status 1支付成功 2发货 3确认收货
    public function confirm_order(): array
    {
        $params = array_merge(request()->all(),[
            'user_id'=>getUserToken()
        ]);
        OrdersDao::confirm_orders($params);
        return Code::message('',200);
    }
}
